<include file="Public:head" />
<style>

    .table-striped tr  .td_dan{
        line-height: 30px;text-align: right;width: 50px
    }
    .width20{
        width: 260px;
    }
</style>
<body class="overflow-hidden">
<div class="wrapper preload">
    <include file="Public:header" />
    <include file="Public:left" />
    <div class="main-container">
        <div class="padding-md">
            <div class="row">
                <div class="col-sm-12">
                    <div class="page-title">
                       {$info['id']?'修改':'新增'}机构
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="smart-widget widget-green">
                        <form action="__SELF__" method="post" class="form-horizontal form_admin7">
                            <table class="table table-striped no-margin">
                                <tr>
                                    <td class="td_dan" >机构名称  <span style="color: red">*</span></td>
                                    <td width="20%" style="text-align: left;">
                                        <input type="text" name="name" value="{$info.name}" id="name" class="form-control width20">
                                    </td>
                                    <td class="td_dan">机构Email <span style="color: red">*</span</td>
                                    <td width="40%"  style="text-align: left;">
                                        <input type="text"  name="email" value="{$info.email}" id="email" class="form-control width20">
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_dan" > 通信地址  <span style="color: red">*</span></td>
                                    <td width="20%" style="text-align: left;">
                                        <input type="text" placeholder="通信地址" name="address" value="{$info.address}" id="address" class="form-control width20">
                                    <td class="td_dan">联系方式 <span style="color: red">*</span></td>
                                    <td width="40%"  style="text-align: left;">
                                        <input type="text" class="form-control width20" name="tel" value="{$info.tel}">
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_dan" > 类型  <span style="color: red">*</span></td>
                                    <td width="20%" style="text-align: left;line-height: 34px;">
                                        <volist name=":getTypeSelect()" id="vo">
                                            <eq name="key" value="$info.typeid">
                                                <input name="typeid" type="radio" value="{$key}" checked="checked">{$vo}</input>
                                                <else/>
                                                <input name="typeid" type="radio" value="{$key}">{$vo}</input>
                                            </eq>
                                        </volist>
                                    </td>
                                    <td class="td_dan unit" style="display: none"> 挂靠单位  <span style="color: red">*</span></td>
                                    <td width="20%" style="text-align: left;display: none"  class="unit">
                                        <select name="unit" class="form-control width20">
                                            <volist name=":getAllUnit()" id="vo">
                                                <option value="{$vo.name}">{$vo.name}</option>
                                            </volist>
                                        </select>
                                    </td>

                                </tr>
                                <tr>
                                    <td class="td_dan" >城市  <span style="color: red">*</span></td>
                                    <td width="20%" style="text-align: left;">
                                        <select class="form-control width20" name="city" style="width: 260px;padding: 5px;">
                                            <volist name=":getCitySelect()" id="vo">
                                                <eq name="key" value="$info.city">
                                                    <option value="{$key}" selected="selected">{$vo}</option>
                                                    <else/>
                                                    <option value="{$key}">{$vo}</option>
                                                </eq>
                                            </volist>
                                        </select>
                                    </td>
                                    <td class="td_dan">账号 <span style="color: red">*</span></td>
                                    <td width="40%"  style="text-align: left;">
                                        <if condition="$info eq 0">
                                        <input class="form-control width20" name="username" id="username" type="text" value="{$info.username}">
                                            <else />
                                            <span style="line-height: 25px">{$info.username}</span>
                                        </if>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_dan" style="line-height: 22px;">查新范围 <span style="color: red">*</span></td>
                                    <td width="40%"  style="text-align: left;" colspan="3">
                                        <volist name="category" id="vo">
                                            <label>
                                                <input type="checkbox" value="{$vo['id']}" name="categoryid[]">{$vo['title']}&nbsp;&nbsp;</input>
                                            </label>
                                        </volist>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4"  >
                                        <input name="id"  type="hidden" value="{$info.id}">
                                        <button type="submit" class="action-button ajax-post" style="margin-left: 40%" target-form="form_admin7">保存</button>
                                        <button type="button" class="action-button " onclick="window.open('{:U("Unit/index")}','_self')">返回</button>
                                    </td>
                                </tr>

                            </table>
                        </form>
                    </div><!-- ./smart-widget -->
                </div><!-- ./col -->
            </div><!-- ./row -->
        </div><!-- ./padding-md -->
    </div><!-- /main-container -->
    <include file="Public:foot" />
</div><!-- /wrapper -->
<!--<include file="Public/base_fc" />-->
<a href="#" class="scroll-to-top hidden-print"><i class="fa fa-chevron-up fa-lg"></i></a>
</body>
</html>
<block name="script">
    <script>
        $(function(){
            highlight_nav2('{:U("Unit/index")}');

        })
        Think.setValue("typeid",{$info.typeid|default =1});
        <present name="info.id">
                Think.setValue("categoryid[]", {$info.categoryid|json_encode}||[0]);
        Think.setValue("typeId",{$info.typeid|default =1});
        </present>
        $(document).ready(function(){
            var obj_check = $('input[name="typeid"]:checked').val();
            if(obj_check==2){
                $(".unit").show();
                $('#categoryId').hide();
            }else if(obj_check==1){
                $('.unit').hide();
            }
        });
        $('input[name="typeid"]').change(function(){
            var typeId = $('input[name="typeid"]:checked').val();
            if(typeId==1){
                $('.unit').hide();
                $('#categoryId').show();
            }else if(typeId==2){
                $(".unit").show();
                $('#categoryId').hide();
            }
        });
    </script>
</block>
